import unittest


class TestDemo01(unittest.TestCase):
    def test01(self):
        print('This is test01.')

    def test02(self):
        print('This is test02.')

    def test03(self):
        print('This is test03.')

    def test04(self):
        print('This is test04.')

    def test05(self):
        print('This is test05.')


if __name__ == '__main__':
    # #特别说明: tests的参数类型必须是可迭代的, 比如列表, 元组
    # suite01 = unittestdemo.TestSuite(tests=[TestDemo01('test02'), TestDemo01('test05')])
    # #tests的参数类型是元组. 如果元组的元素只有一个, 请记得在第一个元素后面加","
    # #TestSuite可以嵌套测试集
    # suite02 = unittestdemo.TestSuite(tests=(TestDemo01('test03'),suite01))
    # r = unittestdemo.TestResult()
    # suite02.run(result=r)
    # print(r.__dict__)

    suite = unittest.TestSuite()
    suite.addTest(TestDemo01('test02'))
    # 注意:addTests方法参数必须是可迭代的, 比如列表, 元组
    suite.addTests([TestDemo01('test01')])
    suite.addTests((TestDemo01('test04'), TestDemo01('test05')))
    r = unittest.TestResult()
    suite.run(result=r)
    print(r.__dict__)
